/**
 * This is my code.
 *
 * $Id$
 */
package fi.jab.esb.config.xml.impl;

import fi.jab.esb.config.xml.AbstractScheduledListener;
import fi.jab.esb.config.xml.XmlPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Abstract Scheduled Listener</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link fi.jab.esb.config.xml.impl.AbstractScheduledListenerImpl#getPollFrequencySeconds <em>Poll Frequency Seconds</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.AbstractScheduledListenerImpl#getScheduleFrequency <em>Schedule Frequency</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.AbstractScheduledListenerImpl#getScheduleidref <em>Scheduleidref</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public abstract class AbstractScheduledListenerImpl extends ListenerImpl implements AbstractScheduledListener
{
  /**
   * The default value of the '{@link #getPollFrequencySeconds() <em>Poll Frequency Seconds</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPollFrequencySeconds()
   * @generated
   * @ordered
   */
  protected static final int POLL_FREQUENCY_SECONDS_EDEFAULT = -1;

  /**
   * The cached value of the '{@link #getPollFrequencySeconds() <em>Poll Frequency Seconds</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPollFrequencySeconds()
   * @generated
   * @ordered
   */
  protected int pollFrequencySeconds = POLL_FREQUENCY_SECONDS_EDEFAULT;

  /**
   * This is true if the Poll Frequency Seconds attribute has been set.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   * @ordered
   */
  protected boolean pollFrequencySecondsESet;

  /**
   * The default value of the '{@link #getScheduleFrequency() <em>Schedule Frequency</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getScheduleFrequency()
   * @generated
   * @ordered
   */
  protected static final int SCHEDULE_FREQUENCY_EDEFAULT = -1;

  /**
   * The cached value of the '{@link #getScheduleFrequency() <em>Schedule Frequency</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getScheduleFrequency()
   * @generated
   * @ordered
   */
  protected int scheduleFrequency = SCHEDULE_FREQUENCY_EDEFAULT;

  /**
   * This is true if the Schedule Frequency attribute has been set.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   * @ordered
   */
  protected boolean scheduleFrequencyESet;

  /**
   * The default value of the '{@link #getScheduleidref() <em>Scheduleidref</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getScheduleidref()
   * @generated
   * @ordered
   */
  protected static final String SCHEDULEIDREF_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getScheduleidref() <em>Scheduleidref</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getScheduleidref()
   * @generated
   * @ordered
   */
  protected String scheduleidref = SCHEDULEIDREF_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected AbstractScheduledListenerImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return XmlPackage.Literals.ABSTRACT_SCHEDULED_LISTENER;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getPollFrequencySeconds()
  {
    return pollFrequencySeconds;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setPollFrequencySeconds(int newPollFrequencySeconds)
  {
    int oldPollFrequencySeconds = pollFrequencySeconds;
    pollFrequencySeconds = newPollFrequencySeconds;
    boolean oldPollFrequencySecondsESet = pollFrequencySecondsESet;
    pollFrequencySecondsESet = true;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.ABSTRACT_SCHEDULED_LISTENER__POLL_FREQUENCY_SECONDS, oldPollFrequencySeconds, pollFrequencySeconds, !oldPollFrequencySecondsESet));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void unsetPollFrequencySeconds()
  {
    int oldPollFrequencySeconds = pollFrequencySeconds;
    boolean oldPollFrequencySecondsESet = pollFrequencySecondsESet;
    pollFrequencySeconds = POLL_FREQUENCY_SECONDS_EDEFAULT;
    pollFrequencySecondsESet = false;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.UNSET, XmlPackage.ABSTRACT_SCHEDULED_LISTENER__POLL_FREQUENCY_SECONDS, oldPollFrequencySeconds, POLL_FREQUENCY_SECONDS_EDEFAULT, oldPollFrequencySecondsESet));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isSetPollFrequencySeconds()
  {
    return pollFrequencySecondsESet;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getScheduleFrequency()
  {
    return scheduleFrequency;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setScheduleFrequency(int newScheduleFrequency)
  {
    int oldScheduleFrequency = scheduleFrequency;
    scheduleFrequency = newScheduleFrequency;
    boolean oldScheduleFrequencyESet = scheduleFrequencyESet;
    scheduleFrequencyESet = true;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.ABSTRACT_SCHEDULED_LISTENER__SCHEDULE_FREQUENCY, oldScheduleFrequency, scheduleFrequency, !oldScheduleFrequencyESet));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void unsetScheduleFrequency()
  {
    int oldScheduleFrequency = scheduleFrequency;
    boolean oldScheduleFrequencyESet = scheduleFrequencyESet;
    scheduleFrequency = SCHEDULE_FREQUENCY_EDEFAULT;
    scheduleFrequencyESet = false;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.UNSET, XmlPackage.ABSTRACT_SCHEDULED_LISTENER__SCHEDULE_FREQUENCY, oldScheduleFrequency, SCHEDULE_FREQUENCY_EDEFAULT, oldScheduleFrequencyESet));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isSetScheduleFrequency()
  {
    return scheduleFrequencyESet;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getScheduleidref()
  {
    return scheduleidref;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setScheduleidref(String newScheduleidref)
  {
    String oldScheduleidref = scheduleidref;
    scheduleidref = newScheduleidref;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.ABSTRACT_SCHEDULED_LISTENER__SCHEDULEIDREF, oldScheduleidref, scheduleidref));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case XmlPackage.ABSTRACT_SCHEDULED_LISTENER__POLL_FREQUENCY_SECONDS:
        return new Integer(getPollFrequencySeconds());
      case XmlPackage.ABSTRACT_SCHEDULED_LISTENER__SCHEDULE_FREQUENCY:
        return new Integer(getScheduleFrequency());
      case XmlPackage.ABSTRACT_SCHEDULED_LISTENER__SCHEDULEIDREF:
        return getScheduleidref();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case XmlPackage.ABSTRACT_SCHEDULED_LISTENER__POLL_FREQUENCY_SECONDS:
        setPollFrequencySeconds(((Integer)newValue).intValue());
        return;
      case XmlPackage.ABSTRACT_SCHEDULED_LISTENER__SCHEDULE_FREQUENCY:
        setScheduleFrequency(((Integer)newValue).intValue());
        return;
      case XmlPackage.ABSTRACT_SCHEDULED_LISTENER__SCHEDULEIDREF:
        setScheduleidref((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.ABSTRACT_SCHEDULED_LISTENER__POLL_FREQUENCY_SECONDS:
        unsetPollFrequencySeconds();
        return;
      case XmlPackage.ABSTRACT_SCHEDULED_LISTENER__SCHEDULE_FREQUENCY:
        unsetScheduleFrequency();
        return;
      case XmlPackage.ABSTRACT_SCHEDULED_LISTENER__SCHEDULEIDREF:
        setScheduleidref(SCHEDULEIDREF_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.ABSTRACT_SCHEDULED_LISTENER__POLL_FREQUENCY_SECONDS:
        return isSetPollFrequencySeconds();
      case XmlPackage.ABSTRACT_SCHEDULED_LISTENER__SCHEDULE_FREQUENCY:
        return isSetScheduleFrequency();
      case XmlPackage.ABSTRACT_SCHEDULED_LISTENER__SCHEDULEIDREF:
        return SCHEDULEIDREF_EDEFAULT == null ? scheduleidref != null : !SCHEDULEIDREF_EDEFAULT.equals(scheduleidref);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (pollFrequencySeconds: ");
    if (pollFrequencySecondsESet) result.append(pollFrequencySeconds); else result.append("<unset>");
    result.append(", scheduleFrequency: ");
    if (scheduleFrequencyESet) result.append(scheduleFrequency); else result.append("<unset>");
    result.append(", scheduleidref: ");
    result.append(scheduleidref);
    result.append(')');
    return result.toString();
  }

} //AbstractScheduledListenerImpl
